<!DOCTYPE html>
<html>
<head>
	<title>segway discovery</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta name="viewport" content="width=device-width,user-scalable=yes" />
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="<?= $domain['static'] ?>business/css/common.css">
	<link rel="stylesheet" type="text/css" href="<?= $domain['static'] ?>business/css/detail_main.css"></head>
<body>
	<?php
// 这里是包含子模板方法
$this->
	load->view('business/templates/header');
?>

<?php
if (empty($content['touroute'])){
	include 'detail_create.php';
} else {
	include 'detail_update.php';
}
?>



<script type="text/javascript">
	var lang = {}
	lang.Noticeofparticipation_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_participation_notice_tips'));?>"
	lang.Voucherinformation_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_voucher_information_tips')); ?>"
	lang.CancellationPolicy_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_cancellation_policy_tips')); ?>"
	lang.Exclusions_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_cost_exclusion_tips')); ?>"
	lang.Inclusions_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_cost_inclusion_tips')); ?>"
	lang.Routeintroduction_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_detail_tips')); ?>"
	lang.Departuretime_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_departure_time_tips')); ?>"
	lang.Businesshours_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_business_hour_tips')); ?>"
	lang.Highlights_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_summary_tips')); ?>"
	lang.Location_con="<?php echo str_replace("\n", "\\n", lang('touroute_field_departure_point_tips')); ?>"
</script>




<?php
// 这里是包含子模板方法
$this->
load->view('business/templates/footer');
?>
<script src="<?= $domain['static'] ?>business/js/jquery.min.js"></script>
<script src="<?= $domain['static'] ?>business/js/common.js"></script>
<script type="text/javascript" src="<?= $domain['static'] ?>business/js/ajaxfileupload.js"></script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=<?php echo $content['search']['google_ak'];?>&callback=initMap&language=<?php echo $content['search']['language'];?>"></script>

<script type="text/javascript" src="<?= $domain['static'] ?>business/js/detail_main.js"></script>


<script type="text/javascript">
	var marker;
	var image = '<?= $domain['static'] ?>business/images/map.png'
	function initMap() {

		var luxian = {
			lat:<?php echo @$content['touroute']['latitude'] ?: 0; ?>,
			lng:<?php echo @$content['touroute']['longitude'] ?: 0;?>
		};
	     var map = new google.maps.Map(document.getElementById('map'), {
	       zoom: 4,
	       center: luxian
	     });
	     marker = new google.maps.Marker({
	   		draggable: true,
	     	animation: google.maps.Animation.DROP,
	        position: luxian,
	        // map: map,
	        icon: image,
	     });
	     var hasmarker = false; //没有标记

	     if (luxian.lat ==0 && luxian.lng == 0) {
	     	map.addListener('click', function(e) {

	     		if ( !hasmarker ) {

	     			placeMarkerAndPanTo(e.latLng, map);
	     			 hasmarker = true;
	     			  update()
	     		}
	     	})
	     }else{

	     	 marker.setMap(map)
	     	 hasmarker = true;
	     }
	  
	     google.maps.event.addListener(marker, 'position_changed', update);
	     update()
	}
	   function placeMarkerAndPanTo(latLng, map) {
	     marker = new google.maps.Marker({
	     	draggable: true,
	     	animation: google.maps.Animation.DROP,
	       position: latLng,
	       map: map,
	        icon: image,
	     });
	     map.panTo(latLng);
	     if (marker.getAnimation() !== null) {
	        marker.setAnimation(null);
	      } else {
	        marker.setAnimation(google.maps.Animation.BOUNCE);
	      }
	   }
	   function update() {
	     var path = marker.getPosition();
	     $('#lat').val( path.lat().toString())
	     $('#lng').val( path.lng().toString())
	   }
</script>
</body>
</html>